SDB:Remote installation

Jump to: navigation, search
This article covers the procedures and methods to install openSUSE on a remote machine.

Performing a Network-only installation

Sometimes it is necessary to upgrade a machine that is only reachable over the network. In openSUSE you have several possibilities to remotely run the installation program. These are:

This tutorial outline here how to install with openSSH. VNC is similar, and for serial console things are even easier. This tip is intended as a hint on how to get things done, not as an in-depth reference.

Note: On a hosted server, it could be wise to don't use the default boot for the install, install on an other partition than the actual running system and use grubonce to boot the install. If ever the install fail, the next reboot will reboot the default running system.

Manual preparation

Get the needed installation files

What you need for a network install is to boot the installation kernel as well as the installation initrd on the remote computer. At the same time, you need to know about the IP-address that the computer will have. Lets suppose that you have a fixed IP-address. If you use dhcp, omit the network definitions and use the IP-address you get from your dhcp server.

First, copy the kernel image and installation initrd to your /boot directory:

cd /boot
wget --output-document=vmlinuz.install http://<path to openSUSE>/boot/<arch>/loader/linux
wget --output-document=initrd.install http://<path to openSUSE>/boot/<arch>/loader/initrd

For stable openSUSE release

  • Replace <version> by your openSUSE release (ie,15.2, ...).
  • Replace <arch> by your architecture (i386 or x86_64).
cd /boot
wget --output-document=vmlinuz.install http://download.opensuse.org/distribution/leap/<version>/repo/oss/boot/<arch>/loader/linux
wget --output-document=initrd.install http://download.opensuse.org/distribution/leap/<version>/repo/oss/boot/<arch>/loader/initrd

For latest Factory development code

  • Replace <arch> by your architecture (i386 or x86_64).
cd /boot
wget --output-document=vmlinuz.install http://download.opensuse.org/factory/repo/oss/boot/<arch>/loader/linux
wget --output-document=initrd.install http://download.opensuse.org/factory/repo/oss/boot/<arch>/loader/initrd

Configure GRUB

Next, prepare your grub configuration to boot these images. If the ip adress of your computer is 192.168.10.10, the gateway to the internet is 192.168.10.1 and your root (/) partition is /dev/hda1, add a section like the following to /boot/grub/menu.lst :

title Boot -- openSUSE 15.2
   root (hd0,0)
   kernel /boot/vmlinuz.install noapic usessh=1 sshpassword="12345678" install=ftp://<path to openSUSE> hostip=192.168.10.10 netmask=255.255.255.0 gateway=192.168.10.1 nameserver=192.168.10.1
   initrd /boot/initrd.install
Note: The password must be at least 8 characters long.
Note: Make sure the IP address is really available before reboot. Even local addresses may cause trouble if the target machine is in a larger network segment.

Note that you must enter the IP-address in the path to openSUSE instead of the name if you do not provide a nameserver. Then make this 1st entry the default by changing menu.lst at the line

default 0

to reflect the section number of your entry.

Note: If you want to boot to another section temporarily, do not change the default. Instead use the command grubonce 0, where 0 is the number of your new section.

After doing this, do a reboot.

For stable openSUSE release

  • Replace <version> by your openSUSE release (ie,15.3, ...).
title Boot -- openSUSE <version>
   root (hd0,0)
   kernel /boot/vmlinuz.install noapic usessh=1 sshpassword="12345645" install=http://download.opensuse.org/distribution/leap/<version>/repo/oss/ hostip=192.168.42.123/24 gateway=192.168.42.1 nameserver=192.168.42.1
   initrd /boot/initrd.install

For latest Factory development release

title Boot -- openSUSE Factory INSTALL
   root (hd0,0)
   kernel /boot/vmlinuz.install usessh=1 sshpassword="12345678" install=http://download.opensuse.org/factory/repo/oss/ hostip=192.139.88.209 netmask=255.255.255.0 gateway=192.139.88.254 nameserver=192.139.88.1
   initrd /boot/initrd.install

Eventually, you may have to give the mirror IP.


Configure GRUB2

Next, prepare your grub2 configuration to boot these images. If the ip adress of your computer is 192.168.10.10, the gateway to the internet is 192.168.10.1 and your root (/) partition is /dev/hda1, add a section like the following to /boot/grub2/custom.cfg :

menuentry 'openSUSE install' {
   insmod gzio
   set root='hd0,msdos1'
   linux /boot/vmlinuz.install noapic usessh=1 sshpassword="12345678" install=ftp://<path to openSUSE> hostip=192.168.10.10 netmask=255.255.255.0 gateway=192.168.10.1 nameserver=192.168.10.1
   initrd /boot/initrd.install
}
Note: The password must be at least 8 characters long.
Note: Make sure the IP address is really available before reboot. Even local addresses may cause trouble if the target machine is in a larger network segment.

Note that you must enter the IP-address in the path to openSUSE instead of the name if you do not provide a nameserver.

Find the number of the menu entry:

grub2-once --list

Note the ID of the installation entry, and instruct grub2 to reboot into it. Assuming entry 5 is 'openSUSE install':

grub2-once 5

After doing this, do a reboot.

For stable openSUSE release

  • Replace <version> by your openSUSE release (ie,15.2, ...).
menuentry 'openSUSE install' {
   insmod gzio
   set root='hd0,msdos1'
   linux /boot/vmlinuz.install noapic usessh=1 sshpassword="12345678" install=http://download.opensuse.org/distribution/leap/15.2/repo/oss/ hostip=192.168.10.10 netmask=255.255.255.0 gateway=192.168.10.1 nameserver=192.168.10.1
   initrd /boot/initrd.install
}

For latest Factory development release

menuentry 'openSUSE install' {
   insmod gzio
   set root='hd0,msdos1'
   linux /boot/vmlinuz.install noapic usessh=1 sshpassword="12345678" install=http://download.opensuse.org/tumbleweed/repo/oss/ hostip=192.168.10.10 netmask=255.255.255.0 gateway=192.168.10.1 nameserver=192.168.10.1
   initrd /boot/initrd.install
}

Automated preparation

Downloading kernel and initrd as well as modifying the grub config can mostly be automated with the Setup GRUB for NFS install script.


Start the installation

The computer will start again after rebooting, but this time booting your installation image instead of the installed system. To reach the installation image, do a ssh to this system:

ssh -X root@192.168.10.10

and enter the password that was given in sshpassword (in the example above, this is "12345645", as 1-8 would be to obvious to phishers;) ). All you have to do now is start yast (or yast2 for graphical installation), and proceed as in a normal installation.

Note: During installation if you're disconnected before you have a chance to entering the root password, then reconnect after a few minutes and enter the given installation password that was set in the grub menu.lst file. After that you have to run /usr/lib/YaST2/startup/YaST2.ssh to continue the installation.

Post-install

After that you may have to run /usr/lib/YaST2/startup/YaST2.ssh to continue the installation.

This may be missed, because it's only usefull to install X, but if not the starting process is somewhat broken.


Remote installation without virtual media access

If you can access some flavour of linux as root, it can be used as a jumping point to booting a opensuse installation utilising ssh or vnc. Below script is CC0 bmwiedemann 2020

 #!/bin/bash
 set -xe
 : ${repo:=https://download.opensuse.org/distribution/openSUSE-stable/repo/oss}
 #: ${repo:=https://download.opensuse.org/tumbleweed/repo/oss}
 : ${arch:=$(uname -m)}
 : ${vncpassword:=supercomplexpassword}
 #: ${append:=vnc=1 vncpassword=$vncpassword}
 : ${append:=ssh=1 sshpassword=$vncpassword}
 #append+=" addon=https://download.opensuse.org/update/openSUSE-stable/"
 #append+=" autoyast=https://www.zq1.de/~bernhard/linux/opensuse/autoyast.leap152.xml"
 pkgs="wget kexec-tools"
 zypper -n install $pkgs ||
   DEBIAN_FRONTEND=noninteractive apt-get -y install $pkgs ||
   dnf install -y $pkgs ||
   pacman --noconfirm -S $pkgs ||
   emerge $pkgs ||
   true
 which wget
 which kexec
 mkdir -p /dev/shm/
 mount -t tmpfs tmpfs /dev/shm
 cd /dev/shm/
 wget $repo/boot/$arch/loader/{linux,initrd}
 kexec -l linux --initrd=initrd --reset-vga --append="install=$repo $append"
 sync ; echo u > /proc/sysrq-trigger ; sync
 kexec -e




More information

The options that may be used at the kernel command line are summarized in either /usr/share/doc/packages/autoyast2/html/appendix.linuxrc.html or /usr/share/doc/packages/linuxrc/linuxrc.html. Instead of using a colon (:) to separate the name and values (as used in a /info file), use an equal sign (=) when adding those options in the GRUB menu to the kernel command line. Linuxrc always tries to find out as much information as possible about the computer, so if you don't provide network connection information, it will try to use dhcp to setup its network.


See also


External links